package com.example.service.impl;

import com.example.mapper.businessReportMapp;
import com.example.pojo.businessReportPojo;
import com.example.service.businessReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * ClassName:businessReportImpl
 * Description:
 *
 * @Author 赵永峰
 * @Create 2025/10/23 15:18
 * @Version 1.0
 */
@Service
public class businessReportImpl implements businessReportService {
    @Autowired
    private businessReportMapp businessReportMapp;
    //辅助函数：对业务汇报中，根据某一个字段查询等于某一值的函数
    public List<businessReportPojo> inquiryBusinessReportOneFiled(Map<String, Object> map){
        String fieldName=(String) map.get("filedName");
        String fieldVal=(String) map.get("filedVal");

        List<businessReportPojo> pojos=businessReportMapp.inquiryOneFiled(fieldName,fieldVal);
        return pojos;
    }
    //辅助函数：对业务汇报中，插入一条数据，所有字段都插入
    public void insertOne(businessReportPojo pojo){
        System.out.println(pojo);
        pojo.setCreate_time(LocalDateTime.now());
        pojo.setUpdate_time(LocalDateTime.now());
        businessReportMapp.insertOne(pojo);
    }
    //辅助函数：向业务汇报的表中根据id，修改一行数据
    public void editOneRowById(businessReportPojo pojo){
        pojo.setUpdate_time(LocalDateTime.now());
        businessReportMapp.editOneRowById(pojo);
    }
}
